import { Button, Input } from "antd";
import { useEffect, useState } from "react";

export default function Index(props: any) {
    // "smtpHost": "smtp.163.com",
    // "smtpPort": "25",
    // "smtpUser": "@163.com",
    // "smtpPass": "OHOTJNZGBDKXWKNT",
    // "smtpFromUser": "@qq.com",
    const [smtpHost, setsmtpHost] = useState('');
    const [smtpPort, setsmtpPort] = useState('');
    const [smtpFromUser, setsmtpFromUser] = useState('');
    const [smtpUser, setsmtpUser] = useState('');
    const [smtpPass, setsmtpPass] = useState('');
    useEffect(() => {
        setsmtpHost(props.InitialValue.smtpHost)
        setsmtpPort(props.InitialValue.smtpPort)
        setsmtpUser(props.InitialValue.smtpUser)
        setsmtpPass(props.InitialValue.smtpPass)
        setsmtpFromUser(props.InitialValue.smtpFromUser)
    }, [])

    console.log(props.InitialValue)
    return (
        <div>
            <p>
                SMTP 地址 <Input value={smtpHost}/>
            </p>
            <p>
                SMTP 端口（强制使用 SSL 连接） <Input value={smtpPort}/>
            </p>
            <p>
                SMTP 用户 <Input value={smtpUser}/>
            </p>
            <p>
                SMTP 密码 <Input value={smtpPass}/>
            </p>
            <p>
                发件人 <Input value={smtpFromUser}/>
            </p>
            <Button type="primary">保存</Button> <Button type="primary">测试</Button>
        </div>
    )
}